package pimp.organizermanager;

import java.util.*;

public class Date
{

    public int getThisDay() {
        return thisDay;
    }

    public void setThisDay(int thisDay) {
        this.thisDay = thisDay;
    }

    public int getThisMonth() {
        return thisMonth;
    }

    public void setThisMonth(int thisMonth) {
        this.thisMonth = thisMonth;
    }

    public int getThisYear() {
        return thisYear;
    }

    public void setThisYear(int thisYear) {
        this.thisYear = thisYear;
    }
    private int thisDay;
    private int thisMonth;
    private int thisYear;
    public Date(String date) {
        
    }

    public Date(int year, int month, int day) {
        thisDay = day;
        thisMonth = month;
        thisYear = year;
        this.printDate();
    }

    /* Is date a less or equal to date b */
    static public boolean compareDates(Date a, Date b) {
        if(a.getThisYear() < b.getThisYear()) {
                return true;
        }
        else if(a.getThisYear() == b.getThisYear()) {
            if(a.getThisMonth() < b.getThisMonth()) {
                return true;
            }
            else if(a.getThisMonth() == b.getThisMonth()) {
                if(a.getThisDay() <= b.getThisDay()) {
                    return true;
                }
                else {
                    return false;
                }
            }
            else {
                return false;
            }
        }
        else {
            return false;
        }
    }

    static public boolean isEqual(Date a, Date b) {
        if (a.getThisYear() != b.getThisYear()) {
            return false;
        }
        if (a.getThisMonth() != b.getThisMonth()) {
            return false;
        }
        if (a.getThisDay() != b.getThisDay()) {
            return false;
        }
        return true;
    }

    public void printDate() {
        int year = this.getThisYear();
        int month = this.getThisMonth();
        int day = this.getThisDay();

        System.out.println(year + "-" + month + "-" + day);
    }

    public int getYear()
    {
        return this.getThisYear();
    }
    
    public int getMonth()
    {
        return this.getThisMonth();
    }
    public int getDay()
    {
        return this.getThisDay();
    }
    @Override
    public String toString() {
        String out = "date";
        return out;
    }
}
